<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE HTML>
<html class="">
<head>
	
	<meta name="author" content="蓝凌科技">
	<meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="format-detection" content="telephone=no">
	<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
	<meta http-equiv="Pragma" content="no-cache" />
	<meta http-equiv="Expires" content="0" />

	<link rel="stylesheet" type="text/css" href="/Public/Api/css/sm.min.css">	
	<link rel="stylesheet" type="text/css" href="/Public/Api/css/sm-extend.min.css">	
	
	<title>帮工小哥</title>
	
	<script type="text/javascript">
	    var _root = '<?php echo ($_site_url); echo U(' / ');?>', _controller = '<?php echo ($_controller); ?>';
	</script>
	
	
	<link rel="stylesheet" type="text/css" href="/Public/Api/css/order.css">


</head>
<body>
	
	

<div class="page-group">
    <div class="page page-current">
        <div class="content login">
            <form action="" class="m-phone">
                <ul>
                    <li>
                        <i class="icon-number"></i>
                        <input type="text" name="tel" id="tel" placeholder="请输入账号" value="<?php echo ($tel); ?>">
                        <div class="delete right">&nbsp;</div>
                    </li>
                    <li>
                        <i class="icon-pwd"></i>
                        <input type="password" name="pwd" id="pwd" placeholder="请输入密码">
                        <input type="hidden" name="historyURL" id="historyURL" value="<?php echo ($historyURL); ?>"/>
                        <div class="delete right">&nbsp;</div>
                    </li>
                    <li class="code" id="verifyli" <?php if($display == '1'): else: ?>style="display:none;"<?php endif; ?>>
                        <i class="icon-valid"></i>
                        <input type="text" name="verify" id="verify" placeholder="请输入验证码">
                        <img class="right" src="<?php echo U('Public/verify');?>" id="verifybtn">
                    </li>
                </ul>
                <div class="pwd">
                    <label><input type="checkbox" name="remember" id="remember" value="1"><span>记住账号</span></label>
                    <a class="forget right" href="<?php echo U('register', 'type=2');?>">忘记密码?</a>
                </div>
                <div class="confirm">
                    <a class="button button-fill button-big" type="button" onclick="login()">登录</a>
                </div>
            </form>
            <div class="login-item">
                <a href="<?php echo U('register');?>">点此注册</a>
            </div>
        </div>
    </div>
</div>




	<!-- 底部
================================================== -->
<footer>
</footer>
<script type="text/javascript">
    (function(){
        var ThinkPHP = window.Think = {
            "ROOT"   : "", //当前网站地址
            "APP"    : "/api.php?s=", //当前项目地址
            "PUBLIC" : "/Public", //项目公共目录地址
            "DEEP"   : "<?php echo C('URL_PATHINFO_DEPR');?>", //PATHINFO分割符
            "MODEL"  : ["<?php echo C('URL_MODEL');?>", "<?php echo C('URL_CASE_INSENSITIVE');?>", "<?php echo C('URL_HTML_SUFFIX');?>"],
            "VAR"    : ["<?php echo C('VAR_MODULE');?>", "<?php echo C('VAR_CONTROLLER');?>", "<?php echo C('VAR_ACTION');?>"]
        }
    })();
    
</script>
<script src="/Public/Api/js/zepto.min.js" type="text/javascript">
</script>
<script type="text/javascript">
//坑死人的配置项
//若不加此配置，则所有页面均使用 js 和 css 缓存
$.config = {
   	router: false
}
</script>
<script src="/Public/Api/js/sm.min.js" type="text/javascript">
</script>
<script src="/Public/Api/js/sm-extend.min.js" type="text/javascript">
</script>
<script src="/Public/Api/js/think.js" type="text/javascript">
</script>


<script src="/Public/Api/js/order.js" type="text/javascript"></script>
<script type="text/javascript">
	
//刷新验证码
var verifyimg = $('#verifybtn').attr("src");

$("#verifybtn").click(function(){

    if (verifyimg.indexOf('?') > 0) {

        $("#verifybtn").attr("src", verifyimg + '&random=' + Math.random());
    }else {

        $("#verifybtn").attr("src", verifyimg.replace(/\?.*$/, '') + '?' + Math.random());
    }
});

function login(){
	
	var tel = $.trim($("#tel").val()) || "";
	var pwd = $.trim($("#pwd").val()) || "";
	var verify = $.trim($("#verify").val()) || "";
	var remember = $("#remember").attr("checked");
	remember = remember ? '1' : '0';
	
	if(!(/^1((3|4|5|8){1}\d{1}|70)\d{8}$/.test(tel))){ 
        $.alert("账号格式有误，请确认");  
        return false; 
    } 

	if(pwd.length == 0){
		$.alert('请输入密码');
		return false;
	}else if($("#verifyli").css("display") != 'none' && verify.length == 0){
		$.alert('请输入验证码');
		return false;
	}
	
	var target = Think.U('Public/login');
	
	$.post(target, {'tel':tel, 'pwd':pwd, 'remember':remember, 'verify':verify}, function(dataObj){
		
		if(dataObj.status == '-1'){
			
			if(dataObj.times){
				$("#verifyli").show();
			}
			
			$.alert("帐号或密码错误");
		}else if(dataObj.status == '-201'){
			$("#verifyli").show();
			$.alert('请输入验证码');
		}else if(dataObj.status == '-202'){
			$.alert('验证码错误');
		}else{
			var historyURL = $("#historyURL").val();
			historyURL = historyURL ? historyURL : Think.U('Index/index');
			window.location.href = historyURL;
		}
	});
}

</script>

<!-- 用于加载js代码 -->

</body>
</html>